<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport"
	      content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>附件列表</title>
</head>
<body>
	<?php include './view/header.php' ?>
	<div class="container">
		<div class="row">
			<?php include './view/left.php' ?>

			<div class="col-lg-9">
				<!-- TAB NAVIGATION -->
				<ul class="nav nav-tabs" role="tablist">
					<li class="active"><a href="" role="tab" data-toggle="tab">附件列表</a></li>
				</ul>
				<table class="table table-hover">
					<thead>
                        <tr>
                            <th>id</th>
                            <th>图片</th>
                            <th>图片地址</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
					</thead>
					<tbody>
                        <?php foreach ($data as $v):?>
                            <tr>
                                <td><?php echo $v['aid']?></td>
                                <td><img src="<?php echo $v['path']?>" style="width: 80px;height: 80px"></td>
                                <td><?php echo $v['path']?></td>
                                <td><?php echo date('Y-m-d H-i-s',$v['createtime'])?></td>
                                <td>
                                    <?php
                                        $defaultImgs = ['./attachment/default-man.jpg','./attachment/default-woman.jpg'];
                                        if(in_array($v['path'],$defaultImgs)):
                                    ?>
                                        <a class="btn-default btn btn-sm disabled">系统默认图片</a>
                                    <?php else:?>
                                        <a href="javascript:if(confirm('删除后不可恢复且影响部分学生的头像显示，确认要删除吗？'))location.href='<?php echo u('remove').'&aid='.$v['aid'];?>'" class="btn btn-danger btn-sm">删除</a>
                                    <?php endif;?>
                                </td>
                            </tr>
                        <?php endforeach;?>
					</tbody>
				</table>

			</div>

		</div>

	</div>

	<?php include './view/footer.php' ?>

	</body>
</html>